package com.fr.data.impl;

import com.fr.base.StringUtils;
import com.fr.base.XMLable;
import com.fr.base.core.ComparatorUtils;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import java.io.Serializable;

public class TreeAttr
  implements XMLable, Serializable
{
  public static final String XML_TAG = "TreeAttr";
  private boolean multipleSelection;
  private String delimiter;
  private String startSymbol;
  private String endSymbol;
  private boolean cascade;
  private boolean returnArray;
  private boolean useAjax;
  private int width;
  private int height;

  public boolean equals(Object paramObject)
  {
    return ((paramObject instanceof TreeAttr) && (this.multipleSelection == ((TreeAttr)paramObject).multipleSelection) && (this.useAjax == ((TreeAttr)paramObject).useAjax) && (ComparatorUtils.equals(this.delimiter, ((TreeAttr)paramObject).delimiter)) && (ComparatorUtils.equals(this.startSymbol, ((TreeAttr)paramObject).startSymbol)) && (ComparatorUtils.equals(this.endSymbol, ((TreeAttr)paramObject).endSymbol)) && (this.returnArray == ((TreeAttr)paramObject).returnArray) && (this.cascade == ((TreeAttr)paramObject).cascade) && (this.width == ((TreeAttr)paramObject).width) && (this.height == ((TreeAttr)paramObject).height));
  }

  public TreeAttr()
  {
    this.multipleSelection = false;
    this.delimiter = ",";
    this.startSymbol = "";
    this.endSymbol = "";
    this.cascade = true;
    this.returnArray = true;
    this.useAjax = true;
  }

  public TreeAttr(boolean paramBoolean)
  {
    this(paramBoolean, paramBoolean, 0, 0);
  }

  public TreeAttr(boolean paramBoolean1, boolean paramBoolean2, int paramInt1, int paramInt2)
  {
    this.multipleSelection = false;
    this.delimiter = ",";
    this.startSymbol = "";
    this.endSymbol = "";
    this.cascade = true;
    this.returnArray = true;
    this.useAjax = true;
    this.multipleSelection = paramBoolean1;
    this.returnArray = paramBoolean2;
    this.width = paramInt1;
    this.height = paramInt2;
  }

  public boolean isMultipleSelection()
  {
    return this.multipleSelection;
  }

  public void setMultipleSelection(boolean paramBoolean)
  {
    this.multipleSelection = paramBoolean;
  }

  public String getDelimiter()
  {
    return this.delimiter;
  }

  public void setDelimiter(String paramString)
  {
    this.delimiter = paramString;
  }

  public String getStartSymbol()
  {
    return this.startSymbol;
  }

  public void setStartSymbol(String paramString)
  {
    this.startSymbol = paramString;
  }

  public String getEndSymbol()
  {
    return this.endSymbol;
  }

  public void setEndSymbol(String paramString)
  {
    this.endSymbol = paramString;
  }

  public boolean isReturnArray()
  {
    return this.returnArray;
  }

  public void setReturnArray(boolean paramBoolean)
  {
    this.returnArray = paramBoolean;
  }

  public boolean isCascade()
  {
    return this.cascade;
  }

  public void setCascade(boolean paramBoolean)
  {
    this.cascade = paramBoolean;
  }

  public int getWidth()
  {
    return this.width;
  }

  public void setWidth(int paramInt)
  {
    this.width = paramInt;
  }

  public int getHeight()
  {
    return this.height;
  }

  public void setHeight(int paramInt)
  {
    this.height = paramInt;
  }

  public boolean isAjax()
  {
    return this.useAjax;
  }

  public void setAjax(boolean paramBoolean)
  {
    this.useAjax = paramBoolean;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str1 = paramXMLableReader.getTagName();
      if (str1.equals("TreeAttr"))
      {
        String str2;
        if ((str2 = paramXMLableReader.getAttr("async")) != null)
          setAjax(false);
        if ((str2 = paramXMLableReader.getAttr("mutiSelect")) != null)
          setMultipleSelection(true);
        if ((str2 = paramXMLableReader.getAttr("ra")) != null)
          setReturnArray(false);
        if (paramXMLableReader.getAttr("delimiter") != null)
          this.delimiter = paramXMLableReader.getAttr("delimiter");
        if (paramXMLableReader.getAttr("start") != null)
          this.startSymbol = paramXMLableReader.getAttr("start");
        if (paramXMLableReader.getAttr("end") != null)
          this.endSymbol = paramXMLableReader.getAttr("end");
        if (paramXMLableReader.getAttr("cascade") != null)
          this.cascade = false;
        if ((str2 = paramXMLableReader.getAttr("width")) != null)
          setWidth(Integer.parseInt(str2));
        if ((str2 = paramXMLableReader.getAttr("height")) != null)
          setHeight(Integer.parseInt(str2));
      }
    }
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("TreeAttr");
    if (!(this.useAjax))
      paramXMLPrintWriter.attr("async", this.useAjax);
    if (this.multipleSelection)
    {
      paramXMLPrintWriter.attr("mutiSelect", isMultipleSelection());
      if (!(this.cascade))
        paramXMLPrintWriter.attr("cascade", this.cascade);
      if (!(this.returnArray))
      {
        paramXMLPrintWriter.attr("ra", isReturnArray());
        if (!(",".equals(this.delimiter)))
          paramXMLPrintWriter.attr("delimiter", this.delimiter);
        if (!(StringUtils.isEmpty(this.startSymbol)))
          paramXMLPrintWriter.attr("start", this.startSymbol);
        if (!(StringUtils.isEmpty(this.endSymbol)))
          paramXMLPrintWriter.attr("end", this.endSymbol);
      }
    }
    if (this.width > 0)
      paramXMLPrintWriter.attr("width", this.width);
    if (this.height > 0)
      paramXMLPrintWriter.attr("height", this.height);
    paramXMLPrintWriter.end();
  }
}